package com.zxlspace.design.pattern.singleton;

/**
 * 单例模式
 * 类在使用的时候加载 ，延缓加载时间(基于类初始化的延迟加载)
 */
public class StaticInnerClassSingleton {
//    静态内部类
    private static class InnerClass {
        private static StaticInnerClassSingleton staticInnerClassSingleton = new StaticInnerClassSingleton();
    }

    private StaticInnerClassSingleton() {

    }

    public static StaticInnerClassSingleton getInstance() {
        return InnerClass.staticInnerClassSingleton;
    }
}
